/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Tp2Principal;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.GridLayout;
import javax.swing.JPanel;

/**
 *
 * @author Usager
 */
public class Case extends JPanel{

    boolean blanc;
    Pion pion1;

    public Case(boolean blanc)
    {
        this.blanc=blanc;
        this.setLayout(new GridLayout(1,1));
    }
    public void paintComponent(Graphics g)
    {
        super.paintComponent(g);

        if(blanc)
        {
            g.setColor(new Color(0,0,255));
        }
        else
        {
            g.setColor(new Color(0,0,150));
        }
        g.fillRect(0, 0, this.getWidth(), this.getHeight());

    }

    public void setPion(Damier.Joueur joueur)
    {
        pion1=new Pion(joueur);
        this.add(pion1);
    }
    public Pion getPion()
    {
        return pion1;
    }







}
